<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<div fxLayout="row" fxLayoutAlign="start">
    <mat-form-field class="w-100" color="accent" fxFlex="100">
        <mat-select
            placeholder="Timestamp converter (unix timestamp)"
            [(value)]="cachedProperty.additionalMetadata.mode"
            data-cy="connect-timestamp-converter"
        >
            <mat-option value="none">None</mat-option>
            <mat-option value="formatString">Date String</mat-option>
            <mat-option value="timeUnit">Date Number</mat-option>
        </mat-select>
    </mat-form-field>
</div>

<div fxLayout="row" fxLayoutAlign="start">
    <div class="form-group" fxFlexAlign="center" fxFlex="100">
        <mat-form-field
            class="w-100"
            *ngIf="cachedProperty.additionalMetadata.mode === 'formatString'"
            color="accent"
            fxFlex="100"
        >
            <input
                class="w-100"
                matInput
                placeholder="E.g. yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
                data-cy="connect-timestamp-string-regex"
                [(ngModel)]="cachedProperty.additionalMetadata.formatString"
            />
        </mat-form-field>
        <mat-form-field
            class="w-100"
            *ngIf="cachedProperty.additionalMetadata.mode === 'timeUnit'"
            color="accent"
            fxFlex="100"
        >
            <mat-select
                placeholder="Current time unit"
                [(value)]="selectedTimeMultiplier"
                data-cy="connect-timestamp-number-dropdown"
            >
                <mat-option
                    value="milliseconds"
                    (click)="cachedProperty.additionalMetadata.multiplier = 0"
                >
                    Milliseconds
                </mat-option>
                <mat-option
                    value="seconds"
                    (click)="
                        cachedProperty.additionalMetadata.multiplier = 1000
                    "
                    >Seconds
                </mat-option>
            </mat-select>
        </mat-form-field>
    </div>
</div>
